layui.use(['table', 'form', 'jquery'], function () {
    let table = layui.table;
    let form = layui.form;
    let $ = layui.jquery;
    let MODULE_PATH1 = rootPath+"/ScaletabController/";
    let MODULE_PATH = rootPath+"/DetectionController/";
    let cols = [
        [
            {type: 'checkbox'},

            {title: 'id', field: 'id', align: 'left'},

            {title: '客户名称', field: 'customer', align: 'left'},

            {title: '主要标准器名称', field: 'mainstandard', align: 'center'},


            {title: '任务单号', field: 'taskno', align: 'left'},


            {title: '准确度等级／MPE1', field: 'mpe1', align: 'center',templet:function(d){
                    return selectDictLabel(mpe1_list, d.mpe1);
                }},

            {title: '创建时间', field: 'createtime', align: 'center'},
            {title: '操作', toolbar: '#scaletab-bar', align: 'center'}
        ]
    ]

    //table表单列表
    table.render({
        elem: '#scaletab-table',
        url: MODULE_PATH + 'listnotIn',
        page: true,
        method: 'get',
        cols: cols,
        skin: 'line',
        toolbar: '#scaletab-toolbar',
        defaultToolbar: [{
            layEvent: 'refresh',
            icon: 'layui-icon-refresh',
        }, 'filter', 'print', 'exports']
    });

    //table图标事件绑定
    table.on('tool(scaletab-table)', function (obj) {
        if (obj.event === 'edit') {
            window.edit(obj);
        }
    });

    //table工具栏绑定
    table.on('toolbar(scaletab-table)', function (obj) {
        if (obj.event === 'refresh') {
            window.refresh();
        }
    });

    //查询按钮绑定
    form.on('submit(scaletab-query)', function (data) {
        table.reload('scaletab-table', {page: {curr: 1}, where: data.field})
        return false;
    });

    window.edit = function (obj) {
        window.location.href=MODULE_PATH1 + 'edit/' + obj.data['id'];
    }

    //刷新按钮
    window.refresh = function () {
        table.reload('scaletab-table');
    }
})